<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: class.maingroup.php 398 2014-01-18 16:01:01Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 398 $
* 	zuletzt geaendert von:	$Author: $
* 	Datum:					$Date: 2014-01-18 16:01:01 +0000 (Sat, 18 Jan 2014) $
*
* 	extends by dirk.mueller (edv-mueller.com)
* 	http://www.itdotmedia.de
*
*   wird immer aufgerufen
* --------------------------------------------------------------------------------------
* 	based on:
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
* 	Copyright (c) since 2011 SEO:mercari
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */
include_once (DIR_WS_INCLUDES.'modules/product_konfigurator/class.base.php');

class maingroup extends base {


  function assign_template(&$smarty, $product_id, $with_form_action) {
    global $db, $xajax;
    
		$sql = "
      select
        ko.*
      from
        mercari_konfigurator_product_option kpo
        inner join mercari_konfigurator_options ko
          on ko.konfigurator_optiongroups_id = 'DESCRIPTION_GROUP'
          and ko.konfigurator_options_id = kpo.konfigurator_option
      where
        kpo.product_id = '".$product_id."'";
    $query = $db->db_query($sql, true);
		if($query->_numOfRows)
      $smarty->assign('DESCRIPTION_GROUP', $query->fields['konfigurator_options_parameter']);

  }

  function print_js($product_id, $with_form_action) {
    $file_name = CURRENT_TEMPLATE.'/module/product_konfigurator/js.main.js';
    if(file_exists(DIR_FS_DOCUMENT_ROOT. 'templates/'. $file_name)) {
      $js_smarty = new Smarty();

      $js_smarty->assign('FORM_ACTION', $with_form_action);
      $js_smarty->assign('IMGPATH_POPUP', DIR_WS_IMAGES.'konfigurator_options/popup_images/');
      $js_smarty->assign('IMGPATH_THMB', DIR_WS_IMAGES.'konfigurator_options/thumbnail_images/');

    	if (!CacheCheck()) {
        $js_smarty->caching = false;
        $js_box = $js_smarty->fetch($file_name);
      } else {
        $js_smarty->caching = true;
        $js_smarty->cache_lifetime = CACHE_LIFETIME;
        $js_smarty->cache_modified_check = CACHE_CHECK;
        $cache_id = $_POST['pID'].$this->group['id'].'js'.$_SESSION['language'].$_SESSION['customers_status']['customers_status_name'];
    		$js_box = $js_smarty->fetch($file_name, $cache_id);
      }

      echo $js_box;
    }
  }
  
  function get_price($product_id, $price, $post) {
    return $price;
  }

}